}
static void
-demo_application_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+demo_application_window_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
- GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation,
+ baseline, out_clip);
if (!window->maximized && !window->fullscreen)
gtk_window_get_size (GTK_WINDOW (window), &window->width, &window->height);
}
static void
-gtk_fishbowl_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_fishbowl_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
for (children = priv->children; children; children = children->next)
{
+ GtkAllocation child_clip;
+
child = children->data;
if (!gtk_widget_get_visible (child->widget))
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;
- gtk_widget_size_allocate (child->widget, &child_allocation);
+ gtk_widget_size_allocate (child->widget, &child_allocation, -1, &child_clip);
}
-
- gtk_widget_set_clip (widget, allocation);
}
static double
}
static void
-entry_size_allocate_cb (GtkEntry *entry,
- GtkAllocation *allocation,
+entry_size_allocate_cb (GtkEntry *entry,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip,
gpointer user_data)
{
GtkEntryIconPosition popover_pos;
gtk_widget_add_tick_callback
gtk_widget_remove_tick_callback
gtk_widget_size_allocate
-gtk_widget_size_allocate_with_baseline
gtk_widget_add_accelerator
gtk_widget_remove_accelerator
gtk_widget_set_accel_path
G_DEFINE_TYPE_WITH_PRIVATE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_WIDGET)
static void
-gtk_accel_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_accel_label_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkAccelLabel *al = GTK_ACCEL_LABEL (widget);
GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (al);
- gtk_widget_size_allocate (priv->box, allocation);
+ gtk_widget_size_allocate (priv->box, allocation, baseline, out_clip);
}
static void
}
static void
-gtk_action_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_action_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (widget));
- GtkAllocation clip = *allocation;
-
- gtk_widget_size_allocate (priv->revealer, (GtkAllocation *)allocation);
- gtk_widget_get_clip (priv->revealer, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->revealer, allocation, baseline, out_clip);
}
static void
}
static void
-gtk_app_chooser_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_app_chooser_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (widget);
GtkAppChooserWidgetPrivate *priv = gtk_app_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_app_chooser_widget_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_app_chooser_widget_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
- gtk_widget_size_allocate (priv->overlay, allocation);
+ gtk_widget_size_allocate (priv->overlay, allocation, baseline, out_clip);
}
static void
}
static void
-gtk_application_window_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_application_window_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);
&menubar_height, NULL, NULL, NULL);
menubar_allocation.height = menubar_height;
- gtk_widget_size_allocate (window->priv->menubar, &menubar_allocation);
+ gtk_widget_size_allocate (window->priv->menubar, &menubar_allocation, baseline, out_clip);
child_allocation.y += menubar_height;
child_allocation.height -= menubar_height;
child = gtk_bin_get_child (GTK_BIN (window));
if (child != NULL && gtk_widget_get_visible (child))
- gtk_widget_size_allocate (child, &child_allocation);
+ gtk_widget_size_allocate (child, &child_allocation, baseline, out_clip);
}
else
- GTK_WIDGET_CLASS (gtk_application_window_parent_class)
- ->size_allocate (widget, allocation);
-
- gtk_widget_set_clip (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_application_window_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
}
static void
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_button_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_button_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_button_box_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_button_box_set_child_property (GtkContainer *container,
}
static void
-gtk_button_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_button_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkButtonBox *bbox = GTK_BUTTON_BOX (widget);
GtkButtonBoxPrivate *priv = bbox->priv;
gint secondary_size;
gint total_size;
gint baseline_height;
- gint baseline;
gint child_baseline;
gint i;
- GtkAllocation clip = *allocation;
GdkRectangle child_clip;
if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
{
- GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
return;
}
}
}
- gtk_widget_size_allocate_with_baseline (child, &child_allocation, child_baseline);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, child_baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
i++;
}
}
g_free (widths);
g_free (heights);
g_free (baselines);
-
- gtk_widget_set_clip (widget, &clip);
}
/**
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_bin_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER)
+static void
+gtk_bin_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
+{
+ GtkBin *bin = GTK_BIN (widget);
+ GtkBinPrivate *priv = gtk_bin_get_instance_private (bin);
+
+ if (priv->child && gtk_widget_get_visible (priv->child))
+ gtk_widget_size_allocate (priv->child, allocation, baseline, out_clip);
+}
+
static void
gtk_bin_class_init (GtkBinClass *class)
{
gtk_widget_set_has_window (GTK_WIDGET (bin), FALSE);
}
-
static GType
gtk_bin_child_type (GtkContainer *container)
{
}
}
-static void
-gtk_bin_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBin *bin = GTK_BIN (widget);
- GtkBinPrivate *priv = gtk_bin_get_instance_private (bin);
-
- if (priv->child && gtk_widget_get_visible (priv->child))
- {
- GtkAllocation clip = *allocation;
-
- gtk_widget_size_allocate (priv->child, allocation);
- gtk_widget_get_clip (priv->child, &clip);
-
- gtk_widget_set_clip (widget, &clip);
- }
-}
-
/**
* gtk_bin_get_child:
* @bin: a #GtkBin
};
static void gtk_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_box_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction);
static void
gtk_box_size_allocate_no_center (GtkWidget *widget,
const GtkAllocation *allocation,
+ int baseline,
GdkRectangle *out_clip)
{
GtkBox *box = GTK_BOX (widget);
gint minimum_above, natural_above;
gint minimum_below, natural_below;
gboolean have_baseline;
- int baseline = -1;
GtkPackType packing;
}
}
- if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- baseline = gtk_widget_get_allocated_baseline (widget);
+ if (private->orientation == GTK_ORIENTATION_VERTICAL)
+ baseline = -1;
/* we only calculate our own baseline if we don't get one passed from the parent
* and any of the child widgets explicitly request one */
child_allocation.y -= child_size;
}
}
- gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
- gtk_widget_get_clip (child->widget, &clip);
+ gtk_widget_size_allocate (child->widget, &child_allocation, baseline, &clip);
gdk_rectangle_union (&clip, out_clip, out_clip);
i++;
}
static void
-gtk_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip = *allocation;
-
- gtk_box_size_allocate_no_center (widget, allocation, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_box_size_allocate_no_center (widget, allocation, baseline, out_clip);
}
static GType
static void gtk_button_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static void gtk_button_unrealize (GtkWidget * widget);
-static void gtk_button_size_allocate (GtkWidget * widget,
- GtkAllocation * allocation);
static gint gtk_button_grab_broken (GtkWidget * widget,
GdkEventGrabBroken * event);
static gint gtk_button_key_release (GtkWidget * widget, GdkEventKey * event);
widget_class->measure = gtk_button_measure_;
widget_class->screen_changed = gtk_button_screen_changed;
widget_class->unrealize = gtk_button_unrealize;
- widget_class->size_allocate = gtk_button_size_allocate;
widget_class->grab_broken_event = gtk_button_grab_broken;
widget_class->key_release_event = gtk_button_key_release;
widget_class->enter_notify_event = gtk_button_enter_notify;
GTK_WIDGET_CLASS (gtk_button_parent_class)->unrealize (widget);
}
-static void
-gtk_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkAllocation clip = *allocation;
- GtkWidget *child;
-
- child = gtk_bin_get_child (GTK_BIN (widget));
- if (child && gtk_widget_get_visible (child))
- {
- gtk_widget_size_allocate_with_baseline (child, allocation,
- gtk_widget_get_allocated_baseline (widget));
- gtk_widget_get_clip (child, &clip);
- }
-
- gtk_widget_set_clip (widget, &clip);
-}
-
static void
gtk_button_do_release (GtkButton *button,
gboolean emit_clicked)
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_calendar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_calendar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_calendar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_calendar_button_press (GtkWidget *widget,
}
static void
-gtk_calendar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_calendar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = calendar->priv;
- (DAY_XSEP * 6))/7;
priv->week_width = 0;
}
-
-
- gtk_widget_set_clip (widget, allocation);
}
GParamSpec *pspec);
static void gtk_cell_view_finalize (GObject *object);
static void gtk_cell_view_dispose (GObject *object);
-static void gtk_cell_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_cell_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_cell_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_cell_view_set_value (GtkCellView *cell_view,
}
static void
-gtk_cell_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_cell_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkCellView *cellview;
GtkCellViewPrivate *priv;
gtk_cell_area_context_allocate (priv->context, width, -1);
else if (alloc_height != allocation->height && priv->orientation == GTK_ORIENTATION_VERTICAL)
gtk_cell_area_context_allocate (priv->context, -1, height);
-
- gtk_widget_set_clip (widget, allocation);
}
static void
}
static void
-gtk_center_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_center_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkCenterBox *self = GTK_CENTER_BOX (widget);
GtkAllocation child_allocation;
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
GtkWidget *child[3];
int child_size[3];
GtkRequestedSize sizes[3];
int size;
int for_size;
- int baseline;
int i;
- GTK_WIDGET_CLASS (gtk_center_box_parent_class)->size_allocate (widget, allocation);
-
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
{
size = allocation->width;
for_size = allocation->height;
- baseline = gtk_widget_get_allocated_baseline (widget);
}
else
{
child_allocation.height = child_size[i];
}
- gtk_widget_size_allocate_with_baseline (child[i], &child_allocation, allocation->y + baseline);
- gtk_widget_get_clip (child[i], &child_clip);
- gdk_rectangle_union (&clip, &clip, &child_clip);
+ gtk_widget_size_allocate (child[i], &child_allocation, allocation->y + baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
static void gtk_check_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
typedef struct {
GtkWidget *indicator_widget;
}
static void
-gtk_check_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_check_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
GtkAllocation child_alloc = { 0 };
- GdkRectangle clip = *allocation;
GdkRectangle child_clip;
GtkWidget *child;
gboolean is_rtl = _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
child_alloc.x = allocation->x;
}
- gtk_widget_size_allocate (priv->indicator_widget, &child_alloc);
- gtk_widget_get_clip (priv->indicator_widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->indicator_widget, &child_alloc, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
child = gtk_bin_get_child (GTK_BIN (widget));
child_alloc.width = allocation->width - child_alloc.width; /* Indicator width */
child_alloc.height = allocation->height;
- gtk_widget_size_allocate (child, &child_alloc);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (child, &child_alloc, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
GtkCssNode *
G_ADD_PRIVATE (GtkCheckMenuItem))
static void
-gtk_check_menu_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_check_menu_item_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip, widget_clip;
+ GtkAllocation child_clip;
GtkAllocation indicator_alloc;
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
gint toggle_size;
- GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate
- (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
gtk_widget_measure (priv->indicator_widget,
GTK_ORIENTATION_HORIZONTAL,
indicator_alloc.y = (allocation->height - indicator_alloc.height) / 2;
- gtk_widget_size_allocate_with_baseline (priv->indicator_widget,
- &indicator_alloc,
- gtk_widget_get_allocated_baseline (widget));
- gtk_widget_get_clip (priv->indicator_widget, &clip);
-
- gtk_widget_get_clip (widget, &widget_clip);
- gdk_rectangle_union (&widget_clip, &clip, &widget_clip);
- gtk_widget_set_clip (widget, &widget_clip);
+ gtk_widget_size_allocate (priv->indicator_widget,
+ &indicator_alloc,
+ baseline,
+ &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
static void
}
static void
-gtk_color_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_color_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkColorButton *button = GTK_COLOR_BUTTON (widget);
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate (priv->button, allocation);
- gtk_widget_get_clip (priv->button, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->button, allocation, baseline, out_clip);
}
static void
}
static void
-plane_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+plane_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkColorPlane *plane = GTK_COLOR_PLANE (widget);
create_surface (plane);
- gtk_widget_set_clip (widget, allocation);
}
static void
}
static void
-swatch_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+swatch_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
- GtkAllocation clip = *allocation, clip2 = *allocation;
-
-
- gtk_widget_size_allocate (swatch->priv->overlay_widget, allocation);
- gtk_widget_get_clip (swatch->priv->overlay_widget, &clip2);
- gdk_rectangle_union (&clip, &clip2, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (swatch->priv->overlay_widget, allocation, -1, out_clip);
}
static void
}
static void
-gtk_combo_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_combo_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
GtkComboBoxPrivate *priv = combo_box->priv;
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate_with_baseline (priv->box, allocation,
- gtk_widget_get_allocated_baseline (widget));
-
- gtk_widget_get_clip (priv->box, &clip);
+ gtk_widget_size_allocate (priv->box, allocation, baseline, out_clip);
if (gtk_widget_get_visible (priv->popup_widget))
{
/* reposition the menu after giving it a new width */
gtk_menu_reposition (GTK_MENU (priv->popup_widget));
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
{
if (!_gtk_widget_is_toplevel (widget))
{
+ GtkAllocation clip;
gtk_widget_get_preferred_size (widget, &requisition, NULL);
gtk_widget_get_allocated_size (widget, &allocation, &baseline);
allocation.width = requisition.width;
if (allocation.height < requisition.height)
allocation.height = requisition.height;
- gtk_widget_size_allocate_with_baseline (widget, &allocation, baseline);
+ gtk_widget_size_allocate (widget, &allocation, baseline, &clip);
}
else
gtk_widget_queue_resize (widget);
static void gtk_entry_unrealize (GtkWidget *widget);
static void gtk_entry_map (GtkWidget *widget);
static void gtk_entry_unmap (GtkWidget *widget);
-static void gtk_entry_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_entry_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_entry_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_entry_event (GtkWidget *widget,
}
static void
-gtk_entry_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_entry_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
- GdkRectangle clip = *allocation;
GtkAllocation child_clip;
gint i;
- priv->text_baseline = gtk_widget_get_allocated_baseline (widget);
-
+ priv->text_baseline = baseline;
priv->text_x = 0;
priv->text_width = allocation->width;
icon_alloc.height = height;
priv->text_width -= width;
- gtk_widget_size_allocate (icon_info->widget, &icon_alloc);
- gtk_widget_get_clip (icon_info->widget, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (icon_info->widget, &icon_alloc, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
progress_alloc.width = allocation->width;
progress_alloc.height = allocation->height;
- gtk_widget_size_allocate (priv->progress_widget, &progress_alloc);
- gtk_widget_get_clip (priv->progress_widget, &child_clip);
-
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->progress_widget, &progress_alloc, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
/* Do this here instead of gtk_entry_size_allocate() so it works
if (completion)
_gtk_entry_completion_resize_popup (completion);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
static void gtk_event_box_unrealize (GtkWidget *widget);
static void gtk_event_box_map (GtkWidget *widget);
static void gtk_event_box_unmap (GtkWidget *widget);
-static void gtk_event_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_event_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_event_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
}
static void
-gtk_event_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_event_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkBin *bin;
GtkAllocation child_allocation;
- gint baseline;
GtkEventBoxPrivate *priv;
GtkWidget *child;
child_allocation.height);
}
- baseline = gtk_widget_get_allocated_baseline (widget);
child = gtk_bin_get_child (bin);
if (child)
- gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
+ gtk_widget_size_allocate (child, &child_allocation, baseline, out_clip);
}
GParamSpec *pspec);
static void gtk_expander_destroy (GtkWidget *widget);
-static void gtk_expander_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_expander_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static gboolean gtk_expander_enter_notify (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean gtk_expander_leave_notify (GtkWidget *widget,
}
static void
-gtk_expander_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_expander_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
- GtkAllocation clip = *allocation;
-
- gtk_widget_size_allocate_with_baseline (priv->box, allocation,
- gtk_widget_get_allocated_baseline (widget));
- gtk_widget_get_clip (priv->box, &clip);
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->box, allocation, baseline, out_clip);
}
static void
}
static void
-gtk_file_chooser_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_file_chooser_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate (priv->child, allocation);
- gtk_widget_get_clip (priv->child, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->child, allocation, baseline, out_clip);
}
static void
static void gtk_file_chooser_dialog_map (GtkWidget *widget);
static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
static void gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void file_chooser_widget_file_activated (GtkFileChooser *chooser,
GtkFileChooserDialog *dialog);
static void file_chooser_widget_default_size_changed (GtkWidget *widget,
}
static void
-gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_file_chooser_dialog_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->size_allocate (widget, allocation);
-
+ GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
if (gtk_widget_is_drawable (widget))
save_dialog_geometry (GTK_FILE_CHOOSER_DIALOG (widget));
}
}
static void
-gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFileChooserWidget *self = GTK_FILE_CHOOSER_WIDGET (widget);
GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
- gtk_widget_size_allocate (priv->box, allocation);
+ gtk_widget_size_allocate (priv->box, allocation, -1, out_clip);
}
static void
int *natural_baseline);
-static void gtk_fixed_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_fixed_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_fixed_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_fixed_add (GtkContainer *container,
}
static void
-gtk_fixed_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_fixed_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFixed *fixed = GTK_FIXED (widget);
GtkFixedPrivate *priv = fixed->priv;
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;
- gtk_widget_size_allocate (child->widget, &child_allocation);
+ gtk_widget_size_allocate (child->widget, &child_allocation, -1, out_clip);
}
}
}
static void
-gtk_flow_box_child_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_flow_box_child_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip = *allocation;
GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
- {
- GdkRectangle child_clip;
-
- gtk_widget_size_allocate (child, allocation);
- gtk_widget_get_clip (child, &child_clip);
-
- gdk_rectangle_union (&child_clip, &clip, &clip);
- }
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (child, allocation, -1, out_clip);
}
/* GObject implementation {{{2 */
}
static void
-gtk_flow_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_flow_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFlowBox *box = GTK_FLOW_BOX (widget);
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
- GtkAllocation clip = *allocation;
GdkRectangle child_clip;
GtkAllocation widget_allocation;
GtkAllocation child_allocation;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
child_allocation.x = allocation->width - child_allocation.x - child_allocation.width;
- gtk_widget_size_allocate (child, &child_allocation);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
item_offset += this_item_size;
item_offset += item_spacing;
g_free (item_sizes);
g_free (line_sizes);
-
- gtk_widget_set_clip (widget, &clip);
}
static GtkSizeRequestMode
}
static void
-gtk_font_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_font_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFontButton *button = GTK_FONT_BUTTON (widget);
GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (button);
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate (priv->button, allocation);
- gtk_widget_get_clip (priv->button, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->button, allocation, baseline, out_clip);
}
static void
}
static void
-gtk_font_chooser_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_font_chooser_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFontChooserWidget *self = GTK_FONT_CHOOSER_WIDGET (widget);
GtkFontChooserWidgetPrivate *priv = gtk_font_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->size_allocate (widget, allocation, -1, out_clip);
- gtk_widget_size_allocate (priv->grid, allocation);
+ gtk_widget_size_allocate (priv->grid, allocation, -1, out_clip);
}
static void
guint param_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_frame_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_frame_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_frame_remove (GtkContainer *container,
GtkWidget *child);
static void gtk_frame_forall (GtkContainer *container,
}
static void
-gtk_frame_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_frame_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFrame *frame = GTK_FRAME (widget);
GtkFramePrivate *priv = frame->priv;
GtkWidget *child;
GtkAllocation new_allocation;
- GtkAllocation clip = *allocation;
- GtkAllocation child_clip = *allocation;
+ GtkAllocation child_clip;
gtk_frame_compute_child_allocation (frame, &new_allocation);
priv->child_allocation = new_allocation;
priv->label_allocation.height = height;
priv->label_allocation.width = width;
- gtk_widget_size_allocate (priv->label_widget, &priv->label_allocation);
- gtk_widget_get_clip (priv->label_widget, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->label_widget, &priv->label_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
{
- gtk_widget_size_allocate (child, &priv->child_allocation);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (child, &priv->child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
}
static void
-gtk_gizmo_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_gizmo_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkGizmo *self = GTK_GIZMO (widget);
- GtkAllocation clip = *allocation;
if (self->allocate_func)
self->allocate_func (self,
allocation,
- gtk_widget_get_allocated_baseline (widget),
- &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ baseline,
+ out_clip);
}
static void
}
static void
-gtk_gl_area_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_gl_area_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkGLArea *area = GTK_GL_AREA (widget);
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
- GTK_WIDGET_CLASS (gtk_gl_area_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_gl_area_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
if (gtk_widget_get_realized (widget))
priv->needs_resize = TRUE;
child_allocation.x = allocation->x + allocation->width
- (child_allocation.x - allocation->x) - child_allocation.width;
- gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
- gtk_widget_get_clip (child->widget, &child_clip);
- gdk_rectangle_union (&child_clip, out_clip, out_clip);
+ gtk_widget_size_allocate (child->widget, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
}
#define GET_SIZE(allocation, orientation) (orientation == GTK_ORIENTATION_HORIZONTAL ? allocation->width : allocation->height)
static void
-gtk_grid_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_grid_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip = *allocation;
- GtkAllocation children_clip = *allocation;
GtkGrid *grid = GTK_GRID (widget);
GtkGridPrivate *priv = grid->priv;
GtkGridRequest request;
GtkOrientation orientation;
if (priv->children == NULL)
- {
- gtk_widget_set_clip (widget, &clip);
- return;
- }
+ return;
request.grid = grid;
gtk_grid_request_position (&request, 0);
gtk_grid_request_position (&request, 1);
- gtk_grid_request_allocate_children (&request, allocation, &children_clip);
- gdk_rectangle_union (&children_clip, &clip, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_grid_request_allocate_children (&request, allocation, out_clip);
}
static void
}
static void
-gtk_header_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_header_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
- GtkAllocation clip = *allocation;
GtkWidget *title_widget;
GtkHeaderBar *bar = GTK_HEADER_BAR (widget);
GtkRequestedSize *sizes;
gint x;
gint child_size;
GtkTextDirection direction;
- GtkAllocation child_clip;
+ GtkAllocation child_clip = {0, };
direction = gtk_widget_get_direction (widget);
nvis_children = count_visible_children (bar);
if (direction == GTK_TEXT_DIR_RTL)
child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width;
- gtk_widget_size_allocate (child->widget, &child_allocation);
- gtk_widget_get_clip (child->widget, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (child->widget, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
next:
i++;
if (title_widget != NULL)
{
- gtk_widget_size_allocate (title_widget, &child_allocation);
- gtk_widget_get_clip (title_widget, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (title_widget, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
child_allocation.y = allocation->y;
else
child_allocation.x = allocation->x + allocation->width - start_width + priv->spacing;
child_allocation.width = start_width - priv->spacing;
- gtk_widget_size_allocate (priv->titlebar_start_box, &child_allocation);
- gtk_widget_get_clip (priv->titlebar_start_box, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->titlebar_start_box, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
if (priv->titlebar_end_box)
else
child_allocation.x = allocation->x + allocation->width - end_width + priv->spacing;
child_allocation.width = end_width - priv->spacing;
- gtk_widget_size_allocate (priv->titlebar_end_box, &child_allocation);
- gtk_widget_get_clip (priv->titlebar_end_box, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->titlebar_end_box, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
/**
G_DEFINE_TYPE (GtkIcon, gtk_icon, GTK_TYPE_WIDGET)
-static void
-gtk_icon_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_set_clip (widget, allocation);
-}
-
static void
gtk_icon_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
- wclass->size_allocate = gtk_icon_size_allocate;
wclass->snapshot = gtk_icon_snapshot;
}
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_icon_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_icon_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_icon_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_icon_view_motion (GtkWidget *widget,
for (list = icon_view->priv->children; list; list = list->next)
{
GtkIconViewChild *child = list->data;
+ GtkAllocation clip;
/* totally ignore our child's requisition */
- gtk_widget_size_allocate (child->widget, &child->area);
+ gtk_widget_size_allocate (child->widget, &child->area, -1, &clip);
}
}
static void
-gtk_icon_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_icon_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
/* Emit any pending signals now */
g_object_thaw_notify (G_OBJECT (icon_view->priv->hadjustment));
g_object_thaw_notify (G_OBJECT (icon_view->priv->vadjustment));
-
- gtk_widget_set_clip (widget, allocation);
}
static void
#define DEFAULT_ICON_SIZE GTK_ICON_SIZE_BUTTON
static void gtk_image_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
-static void gtk_image_size_allocate (GtkWidget *widget,
- GtkAllocation*allocation);
+static void gtk_image_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_image_unmap (GtkWidget *widget);
static void gtk_image_unrealize (GtkWidget *widget);
static void gtk_image_measure (GtkWidget *widget,
}
static void
-gtk_image_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_image_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip = *allocation;
- GdkRectangle extents;
-
_gtk_style_context_get_icon_extents (gtk_widget_get_style_context (widget),
- &extents,
+ out_clip,
allocation->x,
allocation->y,
allocation->width,
allocation->height);
-
- gdk_rectangle_union (&clip, &extents, &clip);
-
- gtk_widget_set_clip (widget, &clip);
}
static void
static void gtk_invisible_realize (GtkWidget *widget);
static void gtk_invisible_style_updated (GtkWidget *widget);
static void gtk_invisible_show (GtkWidget *widget);
-static void gtk_invisible_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
static void gtk_invisible_set_property (GObject *object,
guint prop_id,
const GValue *value,
widget_class->realize = gtk_invisible_realize;
widget_class->style_updated = gtk_invisible_style_updated;
widget_class->show = gtk_invisible_show;
- widget_class->size_allocate = gtk_invisible_size_allocate;
widget_class->destroy = gtk_invisible_destroy;
gobject_class->set_property = gtk_invisible_set_property;
gtk_widget_map (widget);
}
-static void
-gtk_invisible_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_set_clip (widget, allocation);
-}
-
-
static void
gtk_invisible_set_property (GObject *object,
guint prop_id,
GParamSpec *pspec);
static void gtk_label_finalize (GObject *object);
static void gtk_label_destroy (GtkWidget *widget);
-static void gtk_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_label_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_label_state_flags_changed (GtkWidget *widget,
GtkStateFlags prev_state);
static void gtk_label_style_updated (GtkWidget *widget);
}
static void
-gtk_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_label_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkLabel *label = GTK_LABEL (widget);
GtkLabelPrivate *priv = label->priv;
- GdkRectangle clip_rect;
if (priv->layout)
gtk_label_update_layout_width (label);
- gtk_label_get_ink_rect (label, &clip_rect);
- gdk_rectangle_union (&clip_rect, allocation, &clip_rect);
- gtk_widget_set_clip (widget, &clip_rect);
+ gtk_label_get_ink_rect (label, out_clip);
}
static void
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_layout_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_layout_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_layout_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_layout_remove (GtkContainer *container,
static void
-gtk_layout_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_layout_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkLayout *layout = GTK_LAYOUT (widget);
GtkLayoutPrivate *priv = layout->priv;
gtk_layout_set_hadjustment_values (layout);
gtk_layout_set_vadjustment_values (layout);
-
- gtk_widget_set_clip (widget, allocation);
}
/* Container methods
{
GtkAllocation allocation;
GtkRequisition requisition;
+ GtkAllocation child_clip;
allocation.x = child->x;
allocation.y = child->y;
gtk_widget_get_preferred_size (child->widget, &requisition, NULL);
allocation.width = requisition.width;
allocation.height = requisition.height;
-
- gtk_widget_size_allocate (child->widget, &allocation);
+
+ gtk_widget_size_allocate (child->widget, &allocation, -1, &child_clip);
}
/* Callbacks */
/* allocate the empty (unfilled) part */
block_area = *allocation;
- gtk_widget_size_allocate_with_baseline (self->priv->block_widget[inverted ? 0 : 1],
- &block_area,
- baseline);
- gtk_widget_get_clip (self->priv->block_widget[inverted ? 0 : 1], out_clip);
+ gtk_widget_size_allocate (self->priv->block_widget[inverted ? 0 : 1],
+ &block_area,
+ baseline,
+ out_clip);
/* now allocate the filled part */
block_area = *allocation;
block_area.y += allocation->height - block_area.height;
}
- gtk_widget_size_allocate_with_baseline (self->priv->block_widget[inverted ? 1 : 0],
- &block_area,
- baseline);
- gtk_widget_get_clip (self->priv->block_widget[inverted ? 1 : 0], &clip);
+ gtk_widget_size_allocate (self->priv->block_widget[inverted ? 1 : 0],
+ &block_area,
+ baseline,
+ &clip);
gdk_rectangle_intersect (out_clip, &clip, out_clip);
}
for (i = 0; i < num_blocks; i++)
{
- gtk_widget_size_allocate_with_baseline (self->priv->block_widget[i],
- &block_area,
- baseline);
- gtk_widget_get_clip (self->priv->block_widget[i], &clip);
+ gtk_widget_size_allocate (self->priv->block_widget[i],
+ &block_area,
+ baseline,
+ &clip);
gdk_rectangle_intersect (out_clip, &clip, out_clip);
if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
}
static void
-gtk_level_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_level_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (GTK_LEVEL_BAR (widget));
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate (priv->trough_widget, allocation);
- gtk_widget_get_clip (priv->trough_widget, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->trough_widget, allocation, baseline, out_clip);
}
static void
static GType gtk_list_box_child_type (GtkContainer *container);
static GtkSizeRequestMode gtk_list_box_get_request_mode (GtkWidget *widget);
static void gtk_list_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_list_box_drag_leave (GtkWidget *widget,
GdkDragContext *context,
guint time_);
}
static void
-gtk_list_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_list_box_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkListBoxPrivate *priv = BOX_PRIV (widget);
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
GtkAllocation child_allocation;
GtkAllocation header_allocation;
&child_min, NULL, NULL, NULL);
header_allocation.height = allocation->height;
header_allocation.y = child_allocation.y;
- gtk_widget_size_allocate (priv->placeholder, &header_allocation);
- gtk_widget_get_clip (priv->placeholder, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->placeholder, &header_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
child_allocation.y += child_min;
}
&child_min, NULL, NULL, NULL);
header_allocation.height = child_min;
header_allocation.y = child_allocation.y;
- gtk_widget_size_allocate (ROW_PRIV (row)->header, &header_allocation);
- gtk_widget_get_clip (ROW_PRIV (row)->header, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (ROW_PRIV (row)->header,
+ &header_allocation,
+ -1,
+ &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
child_allocation.y += child_min;
}
child_allocation.height = child_min;
ROW_PRIV (row)->height = child_allocation.height;
- gtk_widget_size_allocate (GTK_WIDGET (row), &child_allocation);
- gtk_widget_get_clip (GTK_WIDGET (row), &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (GTK_WIDGET (row), &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
child_allocation.y += child_min;
}
-
- gtk_widget_set_clip (widget, &clip);
}
/**
}
static void
-gtk_list_box_row_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_list_box_row_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkWidget *child;
- GtkAllocation clip = *allocation;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
- {
- gtk_widget_size_allocate (child, allocation);
- gtk_widget_get_clip (child, &clip);
- }
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (child, allocation, baseline, out_clip);
}
/**
static void
resize_handler (GtkWidget *widget,
GtkAllocation *alloc,
+ int baseline,
+ GtkAllocation *out_clip,
GtkWidget *magnifier)
{
gtk_widget_queue_resize (magnifier);
static void gtk_menu_destroy (GtkWidget *widget);
static void gtk_menu_realize (GtkWidget *widget);
static void gtk_menu_unrealize (GtkWidget *widget);
-static void gtk_menu_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_menu_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_menu_show (GtkWidget *widget);
static void gtk_menu_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
}
static void
-gtk_menu_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_menu_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkMenu *menu;
GtkMenuPrivate *priv;
GtkMenuShell *menu_shell;
GtkWidget *child;
GtkAllocation arrow_allocation, child_allocation;
- GtkAllocation clip = *allocation;
GList *children;
gint x, y, i;
gint width, height;
arrow_allocation.height = arrow_border.top;
if (priv->upper_arrow_visible)
- gtk_widget_size_allocate (priv->top_arrow_widget, &arrow_allocation);
+ gtk_widget_size_allocate (priv->top_arrow_widget, &arrow_allocation, -1, out_clip);
arrow_allocation.y = height - y - arrow_border.bottom;
arrow_allocation.height = arrow_border.bottom;
if (priv->lower_arrow_visible)
- gtk_widget_size_allocate (priv->bottom_arrow_widget, &arrow_allocation);
+ gtk_widget_size_allocate (priv->bottom_arrow_widget, &arrow_allocation, -1, out_clip);
width = MAX (1, width);
height = MAX (1, height);
gtk_menu_item_toggle_size_allocate (GTK_MENU_ITEM (child),
priv->toggle_size);
- gtk_widget_size_allocate (child, &child_allocation);
+ gtk_widget_size_allocate (child, &child_allocation, -1, out_clip);
}
}
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_menu_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_menu_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
static gint gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell);
}
static void
-gtk_menu_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_menu_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkMenuBar *menu_bar = GTK_MENU_BAR (widget);
GtkMenuBarPrivate *priv = menu_bar->priv;
- GtkAllocation clip = *allocation;
GtkMenuShell *menu_shell;
GtkWidget *child;
GList *children;
else
child_allocation.x += remaining_space.width;
- gtk_widget_size_allocate (request->data, &child_allocation);
+ gtk_widget_size_allocate (request->data, &child_allocation, -1, out_clip);
}
}
else
else
child_allocation.y += remaining_space.height;
- gtk_widget_size_allocate (request->data, &child_allocation);
+ gtk_widget_size_allocate (request->data, &child_allocation, -1, out_clip);
}
}
g_array_free (requested_sizes, TRUE);
-
- gtk_widget_set_clip (widget, &clip);
}
static GList *
}
static void
-gtk_menu_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_menu_item_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
GtkMenuItemPrivate *priv = menu_item->priv;
- GtkAllocation clip = *allocation;
GtkAllocation child_allocation;
GtkAllocation arrow_clip = { 0 };
GtkAllocation child_clip = *allocation;
arrow_alloc.y = child_allocation.y +
(child_allocation.height - arrow_alloc.height) / 2;
- gtk_widget_size_allocate (priv->arrow_widget, &arrow_alloc);
- gtk_widget_get_clip (priv->arrow_widget, &arrow_clip);
- gdk_rectangle_union (&arrow_clip, &clip, &clip);
- }
+ gtk_widget_size_allocate(priv->arrow_widget, &arrow_alloc, baseline, &arrow_clip);
+ gdk_rectangle_union (out_clip, &arrow_clip, out_clip);
+ }
child_allocation.width = MAX (1, child_allocation.width);
- gtk_widget_size_allocate (child, &child_allocation);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
if (priv->submenu)
gtk_menu_reposition (GTK_MENU (priv->submenu));
-
- gtk_widget_set_clip (widget, &clip);
}
static void
}
static void
-gtk_model_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_model_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
if (GTK_MODEL_BUTTON (widget)->iconic)
{
- GTK_WIDGET_CLASS (gtk_model_button_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_model_button_parent_class)->size_allocate (widget,
+ allocation,
+ baseline,
+ out_clip);
}
else
{
- GtkAllocation clip = *allocation;
GtkAllocation child_clip = *allocation;
GtkModelButton *button;
GtkAllocation child_allocation;
GtkWidget *child;
gint check_min_width, check_nat_width;
gint check_min_height, check_nat_height;
- int baseline;
button = GTK_MODEL_BUTTON (widget);
child = gtk_bin_get_child (GTK_BIN (widget));
child_allocation.width = check_nat_width;
child_allocation.height = check_nat_height;
- gtk_widget_size_allocate_with_baseline (button->indicator_widget, &child_allocation,
- gtk_widget_get_allocated_baseline (widget));
- gtk_widget_get_clip (button->indicator_widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (button->indicator_widget, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (child && gtk_widget_get_visible (child))
{
child_allocation.width = allocation->width - border.left - border.right;
child_allocation.height = allocation->height - border.top - border.bottom;
- baseline = gtk_widget_get_allocated_baseline (widget);
if (baseline != -1)
baseline -= border.top;
- gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
}
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_notebook_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_notebook_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_notebook_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_notebook_popup_menu (GtkWidget *widget);
}
static void
-gtk_notebook_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_notebook_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkNotebookPrivate *priv = notebook->priv;
- GtkAllocation clip = *allocation;
-
- gtk_widget_size_allocate (priv->box, allocation);
- gtk_widget_get_clip (priv->box, &clip);
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->box, allocation, -1, out_clip);
}
static void
}
}
- gtk_widget_size_allocate_with_baseline (page->tab_label,
- &child_allocation,
- baseline);
-
- gtk_widget_get_clip (page->tab_label, out_clip);
+ gtk_widget_size_allocate (page->tab_label, &child_allocation, baseline, out_clip);
}
static gint
{
arrow_allocation.x = allocation->x;
arrow_allocation.width = min;
- gtk_widget_size_allocate (priv->arrow_widget[ii], &arrow_allocation);
- gtk_widget_get_clip (priv->arrow_widget[ii], &arrow_clip);
+ gtk_widget_size_allocate (priv->arrow_widget[ii],
+ &arrow_allocation,
+ -1,
+ &arrow_clip);
allocation->x += min;
allocation->width -= min;
}
{
arrow_allocation.x = allocation->x + allocation->width - min;
arrow_allocation.width = min;
- gtk_widget_size_allocate (priv->arrow_widget[ii], &arrow_allocation);
- gtk_widget_get_clip (priv->arrow_widget[ii], &arrow_clip);
+ gtk_widget_size_allocate (priv->arrow_widget[ii],
+ &arrow_allocation,
+ -1,
+ &arrow_clip);
allocation->width -= min;
}
}
arrow_allocation.width = size1;
arrow_allocation.height = min;
if (priv->arrow_widget[0])
- gtk_widget_size_allocate (priv->arrow_widget[0], &arrow_allocation);
+ gtk_widget_size_allocate (priv->arrow_widget[0], &arrow_allocation, -1, &arrow_clip);
arrow_allocation.x += size1;
arrow_allocation.width = size2;
if (priv->arrow_widget[1])
- gtk_widget_size_allocate (priv->arrow_widget[1], &arrow_allocation);
+ gtk_widget_size_allocate (priv->arrow_widget[1], &arrow_allocation, -1, &arrow_clip);
allocation->y += min;
allocation->height -= min;
}
arrow_allocation.width = size1;
arrow_allocation.height = min;
if (priv->arrow_widget[2])
- gtk_widget_size_allocate (priv->arrow_widget[2], &arrow_allocation);
+ gtk_widget_size_allocate (priv->arrow_widget[2], &arrow_allocation, -1, &arrow_clip);
arrow_allocation.x += size1;
arrow_allocation.width = size2;
if (priv->arrow_widget[3])
- gtk_widget_size_allocate (priv->arrow_widget[3], &arrow_allocation);
+ gtk_widget_size_allocate (priv->arrow_widget[3], &arrow_allocation, -1, &arrow_clip);
allocation->height -= min;
}
break;
{
GtkAllocation fixed_allocation = { priv->drag_window_x, priv->drag_window_y,
child_allocation.width, child_allocation.height };
- gtk_widget_size_allocate (page->tab_widget, &fixed_allocation);
- gtk_widget_get_clip (page->tab_widget, &page_clip);
+ gtk_widget_size_allocate (page->tab_widget, &fixed_allocation, -1, &page_clip);
}
else if (page == priv->detached_tab && priv->operation == DRAG_OPERATION_DETACH)
{
/* needs to be allocated at 0,0
* to be shown in the drag window */
GtkAllocation fixed_allocation = { 0, 0, child_allocation.width, child_allocation.height };
- gtk_widget_size_allocate (page->tab_widget, &fixed_allocation);
- gtk_widget_get_clip (page->tab_widget, &page_clip);
+ gtk_widget_size_allocate (page->tab_widget, &fixed_allocation, -1, &page_clip);
}
else if (gtk_notebook_page_tab_label_is_visible (page))
{
- gtk_widget_size_allocate (page->tab_widget, &child_allocation);
- gtk_widget_get_clip (page->tab_widget, &page_clip);
+ gtk_widget_size_allocate (page->tab_widget, &child_allocation, -1, &page_clip);
}
/* calculate whether to leave a gap based on reorder operation or not */
GtkOverlayChild *child)
{
GtkAllocation child_allocation;
+ GtkAllocation child_clip;
if (!gtk_widget_get_visible (child->widget))
return;
gtk_overlay_compute_child_allocation (overlay, child, &child_allocation);
gtk_overlay_child_update_style_classes (overlay, child->widget, &child_allocation);
- gtk_widget_size_allocate (child->widget, &child_allocation);
+ gtk_widget_size_allocate (child->widget, &child_allocation, -1, &child_clip);
}
static void
-gtk_overlay_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_overlay_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkOverlay *overlay = GTK_OVERLAY (widget);
GtkOverlayPrivate *priv = overlay->priv;
GSList *children;
GtkWidget *main_widget;
- GTK_WIDGET_CLASS (gtk_overlay_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_overlay_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
if (main_widget && gtk_widget_get_visible (main_widget))
- gtk_widget_size_allocate (main_widget, allocation);
+ gtk_widget_size_allocate (main_widget, allocation, -1, out_clip);
for (children = priv->children; children; children = children->next)
gtk_overlay_child_allocate (overlay, children->data);
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_paned_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_paned_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_paned_unrealize (GtkWidget *widget);
static void gtk_paned_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction);
}
static void
-gtk_paned_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_paned_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkPaned *paned = GTK_PANED (widget);
GtkPanedPrivate *priv = paned->priv;
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
if (priv->child1 && gtk_widget_get_visible (priv->child1) &&
child2_allocation.height = child2_height;
}
- gtk_widget_size_allocate (priv->handle_widget, &priv->handle_pos);
- gtk_widget_get_clip (priv->handle_widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->handle_widget, &priv->handle_pos, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (gtk_widget_get_mapped (widget) &&
(old_handle_pos.x != priv->handle_pos.x ||
}
- gtk_widget_size_allocate (priv->child1, &child1_allocation);
- gtk_widget_get_clip (priv->child1, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->child1, &child1_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
- gtk_widget_size_allocate (priv->child2, &child2_allocation);
- gtk_widget_get_clip (priv->child2, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->child2, &child2_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
else
{
gtk_paned_set_child_visible (paned, CHILD1, TRUE);
gtk_paned_set_child_visible (paned, CHILD2, FALSE);
- gtk_widget_size_allocate (priv->child1, &child_allocation);
- gtk_widget_get_clip (priv->child1, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->child1, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
else if (priv->child2 && gtk_widget_get_visible (priv->child2))
{
gtk_paned_set_child_visible (paned, CHILD1, FALSE);
gtk_paned_set_child_visible (paned, CHILD2, TRUE);
- gtk_widget_size_allocate (priv->child2, &child_allocation);
- gtk_widget_get_clip (priv->child2, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->child2, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
else
{
gtk_paned_set_child_visible (paned, CHILD2, FALSE);
}
}
-
- gtk_widget_set_clip (widget, &clip);
}
int *minimum_baseline,
int *natural_baseline);
static void gtk_path_bar_unmap (GtkWidget *widget);
-static void gtk_path_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_path_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_path_bar_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_path_bar_remove (GtkContainer *container,
/* This is a tad complicated
*/
static void
-gtk_path_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_path_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkWidget *child;
GtkPathBar *path_bar = GTK_PATH_BAR (widget);
gint up_slider_offset = 0;
gint down_slider_offset = 0;
GtkRequisition child_requisition;
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
/* No path is set; we don't have to allocate anything. */
if (path_bar->priv->button_list == NULL)
- {
- gtk_widget_set_clip (widget, allocation);
-
- return;
- }
+ return;
direction = gtk_widget_get_direction (widget);
allocation_width = allocation->width;
gtk_widget_set_tooltip_text (child, NULL);
gtk_widget_set_child_visible (child, TRUE);
- gtk_widget_size_allocate (child, &child_allocation);
- gtk_widget_get_clip (child, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, baseline, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (direction == GTK_TEXT_DIR_RTL)
{
{
child_allocation.width = path_bar->priv->slider_width;
child_allocation.x = up_slider_offset + allocation->x;
- gtk_widget_size_allocate (path_bar->priv->up_slider_button, &child_allocation);
- gtk_widget_get_clip (path_bar->priv->up_slider_button, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (path_bar->priv->up_slider_button,
+ &child_allocation,
+ -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
gtk_widget_set_child_visible (path_bar->priv->up_slider_button, TRUE);
gtk_widget_show (path_bar->priv->up_slider_button);
child_allocation.width = path_bar->priv->slider_width;
child_allocation.x = down_slider_offset + allocation->x;
- gtk_widget_size_allocate (path_bar->priv->down_slider_button, &child_allocation);
- gtk_widget_get_clip (path_bar->priv->down_slider_button, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (path_bar->priv->down_slider_button,
+ &child_allocation,
+ -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
gtk_widget_set_child_visible (path_bar->priv->down_slider_button, TRUE);
gtk_widget_show (path_bar->priv->down_slider_button);
{
gtk_widget_set_child_visible (path_bar->priv->down_slider_button, FALSE);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
GtkWidget *child = gtk_bin_get_child (GTK_BIN (popover));
if (child)
- gtk_widget_size_allocate (child, (GtkAllocation*)allocation);
+ gtk_widget_size_allocate (child, allocation, -1, out_clip);
}
static void
static gboolean
transitions_enabled (GtkPopover *popover)
{
+ /*return FALSE;*/
return gtk_settings_get_enable_animations (gtk_widget_get_settings (GTK_WIDGET (popover)));
}
}
static void
-gtk_popover_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_popover_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkPopover *popover = GTK_POPOVER (widget);
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
- GtkAllocation child_clip;
- GtkAllocation clip = *allocation;
GtkAllocation child_alloc = *allocation;
/* Note that we in measure() we add TAIL_HEIGHT in both directions, regardless
break;
}
- gtk_widget_size_allocate (priv->contents_widget, &child_alloc);
- gtk_widget_get_clip (priv->contents_widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->contents_widget, &child_alloc, -1, out_clip);
if (gtk_widget_get_realized (widget))
{
a.x, a.y, a.width, a.height);
gtk_popover_update_shape (popover);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static gboolean
}
static void
-_gtk_popover_parent_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation,
- GtkPopover *popover)
+_gtk_popover_parent_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip,
+ GtkPopover *popover)
{
gtk_popover_update_position (popover);
}
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_progress_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_progress_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_progress_bar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
}
}
- gtk_widget_size_allocate (priv->progress_widget, &alloc);
- gtk_widget_get_clip (priv->progress_widget, out_clip);
+ gtk_widget_size_allocate (priv->progress_widget, &alloc,-1, out_clip);
}
}
static void
-gtk_progress_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_progress_bar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkAllocation clip = *allocation;
GtkAllocation child_clip = *allocation;
GtkProgressBarPrivate *priv;
gint bar_width, bar_height;
alloc.width = bar_width;
alloc.height = bar_height;
- gtk_widget_size_allocate (priv->trough_widget, &alloc);
- gtk_widget_get_clip (priv->trough_widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->trough_widget, &alloc, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (!priv->show_text)
- {
- gtk_widget_set_clip (widget, &clip);
- return;
- }
+ return;
gtk_widget_measure (priv->label, GTK_ORIENTATION_HORIZONTAL, -1,
&text_min, &text_nat,
alloc.height = text_height;
}
- gtk_widget_size_allocate (priv->label, &alloc);
- gtk_widget_get_clip (priv->label, &text_clip);
- gdk_rectangle_union (&clip, &text_clip, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->label, &alloc, -1, &text_clip);
+ gdk_rectangle_union (out_clip, &text_clip, out_clip);
}
static void
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_range_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_range_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_range_unmap (GtkWidget *widget);
static void gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_adjustment_get_value (priv->adjustment),
&slider_alloc);
- gtk_widget_size_allocate (priv->slider_widget, &slider_alloc);
- gtk_widget_get_clip (priv->slider_widget, out_clip);
+ gtk_widget_size_allocate (priv->slider_widget, &slider_alloc, -1, out_clip);
if (gtk_adjustment_get_lower (priv->adjustment) == gtk_adjustment_get_upper (priv->adjustment))
value = 0;
fill_alloc.y += allocation->height - fill_alloc.height;
}
- gtk_widget_size_allocate (priv->fill_widget, &fill_alloc);
- gtk_widget_get_clip (priv->fill_widget, &fill_clip);
+ gtk_widget_size_allocate (priv->fill_widget, &fill_alloc, -1, &fill_clip);
gdk_rectangle_union (out_clip, &fill_clip, out_clip);
}
highlight_alloc.height = MAX (min, allocation->height* value);
}
- gtk_widget_size_allocate (priv->highlight_widget, &highlight_alloc);
- gtk_widget_get_clip (priv->highlight_widget, &highlight_clip);
- gdk_rectangle_union (out_clip, &highlight_clip, out_clip);
+ gtk_widget_size_allocate (priv->highlight_widget, &highlight_alloc, -1, &highlight_clip);
}
}
}
static void
-gtk_range_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_range_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = range->priv;
- GtkAllocation clip = *allocation;
- GtkAllocation child_clip;
GtkBorder border = { 0 };
GtkAllocation box_alloc;
int box_min_width, box_min_height;
box_alloc.width = box_min_width;
box_alloc.height = box_min_height;
- gtk_widget_size_allocate (priv->trough_widget, &box_alloc);
- gtk_widget_get_clip (priv->trough_widget, &child_clip);
+ gtk_widget_size_allocate (priv->trough_widget, &box_alloc, -1, out_clip);
/* TODO: we should compute a proper clip from get_range_border(),
* but this will at least give us outset shadows.
*/
- gdk_rectangle_union (&child_clip, &clip, &clip);
- gtk_widget_set_clip (widget, &clip);
}
static void
}
static void
-gtk_recent_chooser_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_recent_chooser_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkRecentChooserWidget *self = GTK_RECENT_CHOOSER_WIDGET (widget);
GtkRecentChooserWidgetPrivate *priv = gtk_recent_chooser_widget_get_instance_private (self);
- GTK_WIDGET_CLASS (gtk_recent_chooser_widget_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_recent_chooser_widget_parent_class)->size_allocate (widget, allocation, -1, out_clip);
- gtk_widget_size_allocate (priv->chooser, allocation);
+ gtk_widget_size_allocate (priv->chooser, allocation, -1, out_clip);
}
static void
static void gtk_revealer_real_add (GtkContainer *widget,
GtkWidget *child);
-static void gtk_revealer_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_revealer_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_revealer_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
}
static void
-gtk_revealer_get_child_allocation (GtkRevealer *revealer,
- GtkAllocation *allocation,
- GtkAllocation *child_allocation)
+gtk_revealer_get_child_allocation (GtkRevealer *revealer,
+ const GtkAllocation *allocation,
+ GtkAllocation *child_allocation)
{
GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
GtkWidget *child;
}
static void
-gtk_revealer_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_revealer_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkRevealer *revealer = GTK_REVEALER (widget);
GtkWidget *child;
- GtkAllocation clip = *allocation;
child = gtk_bin_get_child (GTK_BIN (revealer));
if (child != NULL && gtk_widget_get_visible (child))
GtkAllocation child_allocation;
gtk_revealer_get_child_allocation (revealer, allocation, &child_allocation);
- gtk_widget_size_allocate (child, &child_allocation);
- gtk_widget_get_clip (child, &clip);
+ gtk_widget_size_allocate (child, &child_allocation, -1, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
static void
}
}
- gtk_widget_size_allocate (priv->value_widget, &value_alloc);
- gtk_widget_get_clip (priv->value_widget, out_clip);
+ gtk_widget_size_allocate (priv->value_widget, &value_alloc, -1, out_clip);
}
static void
indicator_alloc.height = indicator_height;
}
- gtk_widget_size_allocate_with_baseline (mark->indicator_widget, &indicator_alloc, baseline);
- gtk_widget_get_clip (mark->indicator_widget, out_clip);
+ gtk_widget_size_allocate (mark->indicator_widget, &indicator_alloc, baseline, out_clip);
if (mark->label_widget)
{
label_alloc.x = indicator_alloc.x + indicator_alloc.width;
}
- gtk_widget_size_allocate_with_baseline (mark->label_widget, &label_alloc, baseline);
- gtk_widget_get_clip (mark->label_widget, &label_clip);
+ gtk_widget_size_allocate (mark->label_widget, &label_alloc, baseline, &label_clip);
gdk_rectangle_union (out_clip, &label_clip, out_clip);
}
}
mark_alloc.y -= mark_size / 2;
}
- gtk_widget_size_allocate_with_baseline (mark->widget, &mark_alloc, baseline);
- gtk_widget_get_clip (mark->widget, &mark_clip);
+ gtk_widget_size_allocate (mark->widget, &mark_alloc, baseline, &mark_clip);
gdk_rectangle_union (out_clip, &mark_clip, out_clip);
}
}
static void
-gtk_scale_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_scale_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkScale *scale = GTK_SCALE (widget);
GtkScalePrivate *priv = scale->priv;
- GtkAllocation clip = *allocation;
GtkAllocation marks_clip, range_rect, marks_rect;
GtkOrientation orientation;
- GTK_WIDGET_CLASS (gtk_scale_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_scale_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
gtk_range_get_range_rect (GTK_RANGE (scale), &range_rect);
marks_rect = range_rect;
marks_rect.y = 0;
marks_rect.height = marks_height;
- gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect);
- gtk_widget_get_clip (priv->top_marks_widget, &marks_clip);
- gdk_rectangle_union (&clip, &marks_clip, &clip);
+ gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect, -1, &marks_clip);
+ gdk_rectangle_union (out_clip, &marks_clip, out_clip);
}
if (priv->bottom_marks_widget)
marks_rect = range_rect;
marks_rect.y += range_rect.height;
marks_rect.height = marks_height;
- gtk_widget_size_allocate (priv->bottom_marks_widget, &marks_rect);
- gtk_widget_get_clip (priv->bottom_marks_widget, &marks_clip);
- gdk_rectangle_union (&clip, &marks_clip, &clip);
+ gtk_widget_size_allocate (priv->bottom_marks_widget, &marks_rect, -1, &marks_clip);
+ gdk_rectangle_union (out_clip, &marks_clip, out_clip);
}
}
else
marks_rect = range_rect;
marks_rect.x -= marks_width;
marks_rect.width = marks_width;
- gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect);
- gtk_widget_get_clip (priv->top_marks_widget, &marks_clip);
- gdk_rectangle_union (&clip, &marks_clip, &clip);
+ gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect, -1, &marks_clip);
+ gdk_rectangle_union (out_clip, &marks_clip, out_clip);
}
if (priv->bottom_marks_widget)
marks_rect = range_rect;
marks_rect.x += range_rect.width;
marks_rect.width = marks_width;
- gtk_widget_size_allocate (priv->bottom_marks_widget, &marks_rect);
- gtk_widget_get_clip (priv->bottom_marks_widget, &marks_clip);
- gdk_rectangle_union (&clip, &marks_clip, &clip);
+ gtk_widget_size_allocate (priv->bottom_marks_widget, &marks_rect, -1, &marks_clip);
+ gdk_rectangle_union (out_clip, &marks_clip, out_clip);
}
}
GtkAllocation value_clip;
gtk_scale_allocate_value (scale, &value_clip);
- gdk_rectangle_union (&clip, &value_clip, &clip);
+ gdk_rectangle_union (out_clip, &value_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
#define add_slider_binding(binding_set, keyval, mask, scroll) \
}
static void
-gtk_scrollbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_scrollbar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkScrollbar *self = GTK_SCROLLBAR (widget);
GtkScrollbarPrivate *priv = gtk_scrollbar_get_instance_private (self);
- gtk_widget_size_allocate (priv->box, allocation);
-
- gtk_widget_set_clip (widget, allocation);
+ gtk_widget_size_allocate (priv->box, allocation, -1, out_clip);
}
static void
static void gtk_scrolled_window_destroy (GtkWidget *widget);
static void gtk_scrolled_window_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
-static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static gboolean gtk_scrolled_window_scroll_event (GtkWidget *widget,
GdkEventScroll *event);
static gboolean gtk_scrolled_window_focus (GtkWidget *widget,
}
static void
-gtk_scrolled_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_scrolled_window_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
gtk_widget_set_child_visible (priv->hscrollbar, priv->hscrollbar_visible);
if (priv->hscrollbar_visible)
{
+ GtkAllocation clip;
gtk_scrolled_window_allocate_scrollbar (scrolled_window,
priv->hscrollbar,
&child_allocation);
- gtk_widget_size_allocate (priv->hscrollbar, &child_allocation);
+ gtk_widget_size_allocate (priv->hscrollbar, &child_allocation, -1, &clip);
}
gtk_widget_set_child_visible (priv->vscrollbar, priv->vscrollbar_visible);
if (priv->vscrollbar_visible)
{
+ GtkAllocation clip;
gtk_scrolled_window_allocate_scrollbar (scrolled_window,
priv->vscrollbar,
&child_allocation);
- gtk_widget_size_allocate (priv->vscrollbar, &child_allocation);
+ gtk_widget_size_allocate (priv->vscrollbar, &child_allocation, -1, &clip);
}
gtk_scrolled_window_check_attach_pan_gesture (scrolled_window);
-
- gtk_widget_set_clip (widget, allocation);
}
static void
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (swindow);
GtkWidget *widget = GTK_WIDGET (swindow), *child;
GtkAllocation child_allocation;
+ GtkAllocation child_clip;
int sb_width;
int sb_height;
child_allocation.height = MAX (1, child_allocation.height - sb_height);
}
- gtk_widget_size_allocate (child, &child_allocation);
+ gtk_widget_size_allocate (child, &child_allocation, -1, &child_clip);
}
static void
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (separator));
}
-static void
-gtk_separator_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_set_clip (widget, allocation);
-}
-
static void
gtk_separator_class_init (GtkSeparatorClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
- widget_class->size_allocate = gtk_separator_size_allocate;
-
object_class->set_property = gtk_separator_set_property;
object_class->get_property = gtk_separator_get_property;
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_separator_tool_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
static void gtk_separator_tool_item_add (GtkContainer *container,
GtkWidget *child);
object_class->set_property = gtk_separator_tool_item_set_property;
object_class->get_property = gtk_separator_tool_item_get_property;
- widget_class->size_allocate = gtk_separator_tool_item_size_allocate;
-
toolitem_class->create_menu_proxy = gtk_separator_tool_item_create_menu_proxy;
container_class->add = gtk_separator_tool_item_add;
}
}
-static void
-gtk_separator_tool_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_set_clip (widget, allocation);
-}
-
/**
* gtk_separator_tool_item_new:
*
}
static void
-gtk_shortcuts_shortcut_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_shortcuts_shortcut_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GTK_WIDGET_CLASS (gtk_shortcuts_shortcut_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_shortcuts_shortcut_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
- gtk_widget_size_allocate (GTK_WIDGET (GTK_SHORTCUTS_SHORTCUT (widget)->box), allocation);
+ gtk_widget_size_allocate (GTK_WIDGET (GTK_SHORTCUTS_SHORTCUT (widget)->box), allocation, -1, out_clip);
}
static void
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_spin_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_spin_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static gint gtk_spin_button_focus_out (GtkWidget *widget,
GdkEventFocus *event);
static void gtk_spin_button_grab_notify (GtkWidget *widget,
}
static void
-gtk_spin_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_spin_button_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (GTK_SPIN_BUTTON (widget));
- GtkAllocation clip = *allocation;
- gtk_widget_size_allocate_with_baseline (priv->box, allocation,
- gtk_widget_get_allocated_baseline (widget));
- gtk_widget_get_clip (priv->box, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->box, allocation, baseline, out_clip);
}
static gint
*minimum = *natural = DEFAULT_SIZE;
}
-static void
-gtk_spinner_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_set_clip (widget, allocation);
-}
-
static void
gtk_spinner_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
gobject_class->set_property = gtk_spinner_set_property;
widget_class = GTK_WIDGET_CLASS(klass);
- widget_class->size_allocate = gtk_spinner_size_allocate;
widget_class->snapshot = gtk_spinner_snapshot;
widget_class->measure = gtk_spinner_measure;
static void gtk_stack_compute_expand (GtkWidget *widget,
gboolean *hexpand,
gboolean *vexpand);
-static void gtk_stack_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_stack_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_stack_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_stack_measure (GtkWidget *widget,
}
static void
-gtk_stack_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_stack_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkStack *stack = GTK_STACK (widget);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
- GtkAllocation clip = *allocation;
GdkRectangle child_clip;
GtkAllocation child_allocation;
&min, &nat, NULL, NULL);
child_allocation.height = MAX (min, allocation->height);
- gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation);
- gtk_widget_get_clip (priv->last_visible_child->widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
-
+ gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
if (!gdk_rectangle_equal (&priv->last_visible_surface_allocation,
&child_allocation))
child_allocation.x = (allocation->height - child_allocation.height);
}
- gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation);
- gtk_widget_get_clip (priv->visible_child->widget, &child_clip);
- gdk_rectangle_union (&clip, &child_clip, &clip);
+ gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
-
- gtk_widget_set_clip (widget, &clip);
}
#define LERP(a, b, t) ((a) + (((b) - (a)) * (1.0 - (t))))
}
static void
-gtk_switch_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_switch_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkSwitch *self = GTK_SWITCH (widget);
GtkSwitchPrivate *priv = gtk_switch_get_instance_private (self);
- GtkAllocation clip = *allocation;
GtkAllocation child_clip;
GtkAllocation child_alloc;
GtkAllocation slider_alloc;
slider_alloc.width = allocation->width / 2;
slider_alloc.height = allocation->height;
- gtk_widget_size_allocate (priv->slider, &slider_alloc);
+ gtk_widget_size_allocate (priv->slider, &slider_alloc, -1, &child_clip);
gtk_widget_get_clip (priv->slider, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
/* Center ON label in left half */
gtk_widget_measure (priv->on_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
child_alloc.y = (allocation->height - min) / 2;
child_alloc.height = min;
- gtk_widget_size_allocate (priv->on_label, &child_alloc);
- gtk_widget_get_clip (priv->on_label, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
+ gtk_widget_size_allocate (priv->on_label, &child_alloc, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
/* Center OFF label in right half */
gtk_widget_measure (priv->off_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);
gtk_widget_measure (priv->off_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
child_alloc.y = (allocation->height - min) / 2;
child_alloc.height = min;
- gtk_widget_size_allocate (priv->off_label, &child_alloc);
- gtk_widget_get_clip (priv->off_label, &child_clip);
- gdk_rectangle_union (&child_clip, &clip, &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (priv->off_label, &child_alloc, -1, &child_clip);
+ gdk_rectangle_union (out_clip, &child_clip, out_clip);
}
static void
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_text_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_text_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_text_view_realize (GtkWidget *widget);
static void gtk_text_view_unrealize (GtkWidget *widget);
static void gtk_text_view_map (GtkWidget *widget);
GtkTextViewChild *vc)
{
GtkAllocation allocation;
+ GtkAllocation clip;
gtk_text_view_compute_child_allocation (text_view, vc, &allocation);
- gtk_widget_size_allocate (vc->widget, &allocation);
+ gtk_widget_size_allocate (vc->widget, &allocation, -1, &clip);
#if 0
g_print ("allocation for %p allocated to %d,%d yoffset = %d\n",
else
{
GtkAllocation allocation;
+ GtkAllocation clip;
GtkRequisition child_req;
allocation.x = child->x;
allocation.width = child_req.width;
allocation.height = child_req.height;
- gtk_widget_size_allocate (child->widget, &allocation);
+ gtk_widget_size_allocate (child->widget, &allocation, -1, &clip);
}
tmp_list = tmp_list->next;
}
static void
-gtk_text_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_text_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkTextView *text_view;
GtkTextViewPrivate *priv;
* chance to run. So we do the work here.
*/
gtk_text_view_flush_first_validate (text_view);
-
- gtk_widget_set_clip (widget, allocation);
}
static void
int dy)
{
GtkAllocation allocation;
+ GtkAllocation clip;
if (!gtk_widget_is_drawable (widget))
return;
gtk_widget_get_allocation (widget, &allocation);
allocation.x += dx;
allocation.y += dy;
- gtk_widget_size_allocate (widget, &allocation);
+ gtk_widget_size_allocate (widget, &allocation, -1, &clip);
}
static void
static void gtk_toolbar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_toolbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_toolbar_style_updated (GtkWidget *widget);
static gboolean gtk_toolbar_focus (GtkWidget *widget,
GtkDirectionType dir);
}
static void
-gtk_toolbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_toolbar_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
GtkToolbarPrivate *priv = toolbar->priv;
if (need_arrow)
{
- gtk_widget_size_allocate (GTK_WIDGET (priv->arrow_button),
- &arrow_allocation);
+ gtk_widget_size_allocate (GTK_WIDGET (priv->arrow_button), &arrow_allocation, -1, out_clip);
gtk_widget_show (GTK_WIDGET (priv->arrow_button));
}
else
g_free (allocations);
g_free (new_states);
-
- gtk_widget_set_clip (widget, allocation);
}
static void
toolbar_content_size_allocate (ToolbarContent *content,
GtkAllocation *allocation)
{
+ GtkAllocation clip;
+
content->allocation = *allocation;
- gtk_widget_size_allocate (GTK_WIDGET (content->item),
- allocation);
+ gtk_widget_size_allocate (GTK_WIDGET (content->item), allocation, -1, &clip);
}
static void
}
static void
-gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_tool_item_group_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (widget);
GtkToolItemGroupPrivate* priv = group->priv;
orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
/* chain up */
- GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->size_allocate (widget, allocation,
+ baseline, out_clip);
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.x = allocation->width - child_allocation.width;
}
- gtk_widget_size_allocate (priv->header, &child_allocation);
+ gtk_widget_size_allocate (priv->header, &child_allocation, -1, out_clip);
if (GTK_ORIENTATION_VERTICAL == orientation)
child_allocation.y += child_allocation.height;
child_allocation.height = item_size.height;
- gtk_widget_size_allocate (GTK_WIDGET (child->item), &child_allocation);
+ gtk_widget_size_allocate (GTK_WIDGET (child->item), &child_allocation, -1, out_clip);
gtk_widget_set_child_visible (GTK_WIDGET (child->item), TRUE);
}
}
static void
-gtk_tool_item_group_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_tool_item_group_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- gtk_tool_item_group_real_size_allocate (widget, allocation);
-
- gtk_widget_queue_draw (widget);
+ gtk_tool_item_group_real_size_allocate (widget, allocation, baseline, out_clip);
}
static void
static void
-gtk_tool_palette_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_tool_palette_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkToolPalette *palette = GTK_TOOL_PALETTE (widget);
GtkAdjustment *adjustment = NULL;
direction = gtk_widget_get_direction (widget);
- GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->size_allocate (widget, allocation);
+ GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->size_allocate (widget, allocation,
+ baseline, out_clip);
if (GTK_ORIENTATION_VERTICAL == palette->priv->orientation)
{
else
child_allocation.x = x;
- gtk_widget_size_allocate (GTK_WIDGET (group->widget), &child_allocation);
+ gtk_widget_size_allocate (GTK_WIDGET (group->widget), &child_allocation, -1, out_clip);
gtk_widget_show (GTK_WIDGET (group->widget));
if (GTK_ORIENTATION_VERTICAL == palette->priv->orientation)
gpointer data)
{
GtkAllocation allocation;
+ GtkAllocation clip;
GtkWidget *widget = GTK_WIDGET (data);
gtk_widget_get_allocation (widget, &allocation);
- gtk_tool_palette_size_allocate (widget, &allocation);
+ gtk_tool_palette_size_allocate (widget, &allocation, -1, &clip);
}
static void
int *natural,
int *minimum_baseline,
int *natural_baseline);
-static void gtk_tree_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_tree_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_tree_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_tree_view_key_press (GtkWidget *widget,
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GtkAllocation drag_allocation;
+ GtkAllocation clip;
GtkWidget *button;
if (tree_view->priv->drag_column == NULL)
drag_allocation.y = 0;
drag_allocation.width = gdk_window_get_width (tree_view->priv->drag_window);
drag_allocation.height = gdk_window_get_height (tree_view->priv->drag_window);
- gtk_widget_size_allocate (button, &drag_allocation);
+ gtk_widget_size_allocate (button, &drag_allocation, -1, &clip);
}
static void
-gtk_tree_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_tree_view_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *tmp_list;
child_rect.y = MAX (min_y, MIN (max_y, child_rect.y));
gtk_tree_path_free (path);
- gtk_widget_size_allocate (child->widget, &child_rect);
+ gtk_widget_size_allocate (child->widget, &child_rect, -1, out_clip);
}
-
- gtk_widget_set_clip (widget, allocation);
}
/* Grabs the focus and unsets the GTK_TREE_VIEW_DRAW_KEYFOCUS flag */
GdkDevice *device)
{
GtkAllocation allocation;
+ GtkAllocation clip;
GtkAllocation button_allocation;
GtkWidget *button;
GtkStyleContext *context;
tree_view->priv->drag_column_x = button_allocation.x;
allocation = button_allocation;
allocation.x = 0;
- gtk_widget_size_allocate (button, &allocation);
+ gtk_widget_size_allocate (button, &allocation, -1, &clip);
tree_view->priv->drag_column = column;
gdk_window_show (tree_view->priv->drag_window);
gboolean rtl;
GtkAllocation allocation = { 0, 0, 0, 0 };
GtkAllocation widget_allocation;
+ GtkAllocation clip;
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
allocation.width = width;
allocation.height = _gtk_tree_view_get_header_height (GTK_TREE_VIEW (priv->tree_view));
- gtk_widget_size_allocate (priv->button, &allocation);
+ gtk_widget_size_allocate (priv->button, &allocation, -1, &clip);
}
if (priv->window)
static void gtk_viewport_destroy (GtkWidget *widget);
static void gtk_viewport_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
-static void gtk_viewport_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_viewport_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data);
static void viewport_set_adjustment (GtkViewport *viewport,
}
static void
-gtk_viewport_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_viewport_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkViewport *viewport = GTK_VIEWPORT (widget);
GtkViewportPrivate *priv = viewport->priv;
- GtkAllocation clip = *allocation;
GtkAdjustment *hadjustment = priv->hadjustment;
GtkAdjustment *vadjustment = priv->vadjustment;
GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
{
- GtkAllocation child_allocation;
+ GtkAllocation child_allocation, child_clip;
child_allocation.x = allocation->x - gtk_adjustment_get_value (hadjustment);
child_allocation.y = allocation->y - gtk_adjustment_get_value (vadjustment);
child_allocation.width = gtk_adjustment_get_upper (hadjustment);
child_allocation.height = gtk_adjustment_get_upper (vadjustment);
- gtk_widget_size_allocate (child, &child_allocation);
- gtk_widget_get_clip (child, &clip);
+ /* Explicitly ignore the child clip here. */
+ gtk_widget_size_allocate (child, &child_allocation, -1, &child_clip);
}
g_object_thaw_notify (G_OBJECT (hadjustment));
g_object_thaw_notify (G_OBJECT (vadjustment));
-
- gtk_widget_set_clip (widget, &clip);
}
static void
static void gtk_widget_real_unmap (GtkWidget *widget);
static void gtk_widget_real_realize (GtkWidget *widget);
static void gtk_widget_real_unrealize (GtkWidget *widget);
-static void gtk_widget_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_widget_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static void gtk_widget_real_direction_changed(GtkWidget *widget,
GtkTextDirection previous_direction);
* @widget: the object which received the signal.
* @allocation: (type Gtk.Allocation): the region which has been
* allocated to the widget.
+ * @baseline: the baseline
+ * @out_clip: (type Gtk.Allocation): Return address for the widget's clip
*/
widget_signals[SIZE_ALLOCATE] =
g_signal_new (I_("size-allocate"),
G_STRUCT_OFFSET (GtkWidgetClass, size_allocate),
NULL, NULL,
NULL,
- G_TYPE_NONE, 1,
- GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
+ G_TYPE_NONE, 3,
+ GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE,
+ G_TYPE_INT,
+ GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* GtkWidget::state-flags-changed:
{
GtkWidget *parent;
cairo_region_t *region2;
- GtkAllocation alloc;
int x, y;
GtkCssStyle *parent_style;
GtkBorder border, padding;
g_assert (parent != NULL);
/* @region's coordinates are originally relative to @widget's origin */
- gtk_widget_get_allocation (widget, &alloc);
if (widget != parent)
gtk_widget_translate_coordinates (_gtk_widget_get_parent (widget),
parent,
/**
- * gtk_widget_size_allocate_with_baseline:
+ * gtk_widget_size_allocate:
* @widget: a #GtkWidget
* @allocation: position and size to be allocated to @widget
* @baseline: The baseline of the child, or -1
+ * @out_clip: (out): Return location for @widget's clip region. The returned clip
+ * will be in the coordinate system of @widget's parent, just like @allocation.
*
- * This function is only used by #GtkContainer subclasses, to assign a size,
+ * This function is only used by #GtkWidget subclasses, to assign a size,
* position and (optionally) baseline to their child widgets.
*
- * In this function, the allocation and baseline may be adjusted. It
- * will be forced to a 1x1 minimum size, and the
- * adjust_size_allocation virtual and adjust_baseline_allocation
- * methods on the child will be used to adjust the allocation and
- * baseline. Standard adjustments include removing the widget's
- * margins, and applying the widget’s #GtkWidget:halign and
- * #GtkWidget:valign properties.
+ * In this function, the allocation and baseline may be adjusted. The given
+ * allocation will be forced to be bigger than the widget's minimum size,
+ * as well as at least 1×1 in size.
*
* Since: 3.10
**/
void
-gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
- GtkAllocation *allocation,
- gint baseline)
+gtk_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GdkRectangle real_allocation;
gint min_width, min_height;
GtkCssStyle *style;
GtkBorder margin, border, padding;
+ GtkAllocation new_clip;
g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (!priv->visible && !_gtk_widget_is_toplevel (widget))
- return;
+ g_return_if_fail (baseline >= -1);
+ g_return_if_fail (out_clip != NULL);
+ g_return_if_fail (allocation != NULL);
gtk_widget_push_verify_invariants (widget);
+ if (!priv->visible && !_gtk_widget_is_toplevel (widget))
+ {
+ memset (out_clip, 0, sizeof (GdkRectangle));
+ goto out;
+ }
+
#ifdef G_ENABLE_DEBUG
if (GTK_DISPLAY_DEBUG_CHECK (gtk_widget_get_display (widget), RESIZE))
{
depth = 0;
parent = widget;
while (parent)
- {
- depth++;
- parent = _gtk_widget_get_parent (parent);
- }
+ {
+ depth++;
+ parent = _gtk_widget_get_parent (parent);
+ }
name = g_type_name (G_OBJECT_TYPE (G_OBJECT (widget)));
g_message ("gtk_widget_size_allocate: %*s%s %d %d %d %d, baseline %d",
/* Set the widget allocation to real_allocation now, pass the smaller allocation to the vfunc */
priv->allocation = real_allocation;
- priv->clip = real_allocation;
priv->allocated_baseline = baseline;
if (!alloc_needed && !size_changed && !baseline_changed)
- goto out;
+ {
+ gtk_widget_set_clip (widget, &priv->reported_clip);
+ *out_clip = priv->clip;
+
+ /* Still have to move the window... */
+ if (_gtk_widget_get_realized (widget) &&
+ _gtk_widget_get_has_window (widget))
+ {
+ GtkAllocation window_alloc;
+
+ gtk_widget_get_window_allocation (widget, &window_alloc);
+ gdk_window_move_resize (priv->window,
+ window_alloc.x, window_alloc.y,
+ window_alloc.width, window_alloc.height);
+ }
+
+ goto check_clip;
+ }
/* Since gtk_widget_measure does it for us, we can be sure here that
* the given alloaction is large enough for the css margin/bordder/padding */
margin.right + border.right + padding.right;
real_allocation.height -= margin.top + border.top + padding.top +
margin.bottom + border.bottom + padding.bottom;
+ new_clip = real_allocation;
if (g_signal_has_handler_pending (widget, widget_signals[SIZE_ALLOCATE], 0, FALSE))
- g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation);
+ g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0,
+ &real_allocation,
+ baseline,
+ &new_clip);
else
- GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget, &real_allocation);
+ GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget,
+ &real_allocation,
+ baseline,
+ &new_clip);
/* Size allocation is god... after consulting god, no further requests or allocations are needed */
#ifdef G_ENABLE_DEBUG
gtk_widget_get_name (widget), widget);
}
#endif
+
+ priv->reported_clip = new_clip;
+ gtk_widget_set_clip (widget, &priv->reported_clip);
+ *out_clip = priv->clip;
+
gtk_widget_ensure_resize (widget);
priv->alloc_needed = FALSE;
priv->alloc_needed_on_child = FALSE;
+check_clip:
size_changed |= (old_clip.width != priv->clip.width ||
old_clip.height != priv->clip.height);
position_changed |= (old_clip.x != priv->clip.x ||
gtk_widget_pop_verify_invariants (widget);
}
-
-/**
- * gtk_widget_size_allocate:
- * @widget: a #GtkWidget
- * @allocation: position and size to be allocated to @widget
- *
- * This function is only used by #GtkContainer subclasses, to assign a size
- * and position to their child widgets.
- *
- * In this function, the allocation may be adjusted. It will be forced
- * to a 1x1 minimum size, and the adjust_size_allocation virtual
- * method on the child will be used to adjust the allocation. Standard
- * adjustments include removing the widget’s margins, and applying the
- * widget’s #GtkWidget:halign and #GtkWidget:valign properties.
- *
- * For baseline support in containers you need to use gtk_widget_size_allocate_with_baseline()
- * instead.
- **/
-void
-gtk_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- gtk_widget_size_allocate_with_baseline (widget, allocation, -1);
-}
-
/**
* gtk_widget_common_ancestor:
* @widget_a: a #GtkWidget
}
static void
-gtk_widget_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_widget_real_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
- GtkWidgetPrivate *priv = widget->priv;
+ GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
if (_gtk_widget_get_realized (widget) &&
_gtk_widget_get_has_window (widget))
{
- gdk_window_move_resize (priv->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
+ GtkAllocation window_alloc;
+
+ gtk_widget_get_window_allocation (widget, &window_alloc);
+ gdk_window_move_resize (priv->window,
+ window_alloc.x, window_alloc.y,
+ window_alloc.width, window_alloc.height);
}
}
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GtkBorder shadow;
- GtkAllocation allocation;
- GtkBorder margin, border, padding;
+ GtkBorder margin;
GtkCssStyle *style;
GdkRectangle new_clip;
+ GtkAllocation allocation;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (_gtk_widget_get_visible (widget) || _gtk_widget_is_toplevel (widget));
g_return_if_fail (clip != NULL);
+ style = gtk_css_node_get_style (priv->cssnode);
+ get_box_margin (style, &margin);
+ _gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
+
+ /* The given clip is in @widget's coordinates, but we need it to be in the parent's coordinates,
+ * just like priv->allocation is. So first we transform the clip, then union it with
+ * the allocation (minus css margins) and then we add the box shadow size. */
+ new_clip = *clip;
+ new_clip.x += priv->allocation.x + margin.left;
+ new_clip.y += priv->allocation.y + margin.top;
+
+ allocation = priv->allocation;
+ allocation.x += margin.left;
+ allocation.y += margin.top;
+ allocation.width -= margin.left + margin.right;
+ allocation.height -= margin.top + margin.bottom;
+
+ gdk_rectangle_union (&allocation, &new_clip, &priv->clip);
+ priv->clip.x -= shadow.left;
+ priv->clip.y -= shadow.top;
+ priv->clip.width += shadow.left + shadow.right;
+ priv->clip.height += shadow.top + shadow.bottom;
+
#ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (GEOMETRY))
{
gint depth;
GtkWidget *parent;
const gchar *name;
+ const char *cssname;
depth = 0;
parent = widget;
while (parent)
- {
- depth++;
- parent = _gtk_widget_get_parent (parent);
- }
+ {
+ depth++;
+ parent = _gtk_widget_get_parent (parent);
+ }
name = g_type_name (G_OBJECT_TYPE (G_OBJECT (widget)));
- g_message ("gtk_widget_set_clip: %*s%s %d %d %d %d",
- 2 * depth, " ", name,
- clip->x, clip->y,
- clip->width, clip->height);
+ cssname = gtk_css_node_get_name (priv->cssnode);
+ g_message ("gtk_widget_set_clip: %s %s %d %d %d %d",
+ name,
+ cssname,
+ priv->clip.x, priv->clip.y,
+ priv->clip.width, priv->clip.height);
}
#endif /* G_ENABLE_DEBUG */
-
-
- /* The given clip is relative to the widget's origin, but we union
- * it with priv->allocation, which is the orgin minus CSS padding, border and margin.
- * Additionally, the box shadow is drawn around the widget's border box */
-
- style = gtk_css_node_get_style (priv->cssnode);
- allocation = priv->allocation;
- get_box_margin (style, &margin);
- get_box_margin (style, &border);
- get_box_margin (style, &padding);
- _gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
-
- /* Get border box from allocation */
- allocation.x += margin.left;
- allocation.y += margin.top;
- allocation.width -= margin.left + margin.right;
- allocation.height -= margin.top + margin.bottom;
-
- /* Add box shadow size to border box */
- allocation.x -= shadow.left;
- allocation.y -= shadow.top;
- allocation.width += shadow.left + shadow.right;
- allocation.height += shadow.top + shadow.bottom;
-
- /* Transform clip into coordinate space of priv->allocation */
- new_clip = *clip;
- new_clip.x += priv->allocation.x + border.left + padding.left;
- new_clip.y += priv->allocation.y + border.top + padding.top;
- new_clip.width -= margin.left + margin.right;
- new_clip.height -= margin.top + margin.bottom;
-
- gdk_rectangle_union (&allocation, &new_clip, &priv->clip);
}
/**
* Retrieves the widget’s allocated size.
*
* This function returns the last values passed to
- * gtk_widget_size_allocate_with_baseline(). The value differs from
+ * gtk_widget_size_allocate(). The value differs from
* the size returned in gtk_widget_get_allocation() in that functions
* like gtk_widget_set_halign() can adjust the allocation, but not
* the value returned by this function.
if (priv->alloc_needed)
{
GtkAllocation allocation;
+ GtkAllocation clip;
int baseline;
gtk_widget_get_allocated_size (widget, &allocation, &baseline);
- gtk_widget_size_allocate_with_baseline (widget, &allocation, baseline);
+ gtk_widget_size_allocate (widget, &allocation, baseline, &clip);
}
else if (priv->alloc_needed_on_child)
{
void (* unmap) (GtkWidget *widget);
void (* realize) (GtkWidget *widget);
void (* unrealize) (GtkWidget *widget);
- void (* size_allocate) (GtkWidget *widget,
- GtkAllocation *allocation);
+ void (* size_allocate) (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
void (* state_flags_changed) (GtkWidget *widget,
GtkStateFlags previous_state_flags);
void (* parent_set) (GtkWidget *widget,
GdkFrameClock* gtk_widget_get_frame_clock (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
-void gtk_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-GDK_AVAILABLE_IN_3_10
-void gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
- GtkAllocation *allocation,
- gint baseline);
+void gtk_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
GDK_AVAILABLE_IN_ALL
GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
guint halign : 4;
guint valign : 4;
- guint clip_set : 1;
-
guint8 alpha;
guint8 user_alpha;
gint allocated_size_baseline;
GtkAllocation allocation;
GtkAllocation clip;
+ GtkAllocation reported_clip;
gint allocated_baseline;
/* The widget's requested sizes */
static void gtk_window_unmap (GtkWidget *widget);
static void gtk_window_realize (GtkWidget *widget);
static void gtk_window_unrealize (GtkWidget *widget);
-static void gtk_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+static void gtk_window_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip);
static gboolean gtk_window_map_event (GtkWidget *widget,
GdkEventAny *event);
static gint gtk_window_configure_event (GtkWidget *widget,
allocation.height == 1)
{
GdkRectangle request;
+ GdkRectangle clip;
gtk_window_compute_configure_request (window, &request, NULL, NULL);
allocation.y = 0;
allocation.width = request.width;
allocation.height = request.height;
- gtk_widget_size_allocate (widget, &allocation);
+ gtk_widget_size_allocate (widget, &allocation, -1, &clip);
gtk_widget_queue_resize (widget);
GtkWindow *window)
{
cairo_rectangle_int_t rect;
+ GtkAllocation clip;
if (GTK_IS_POPOVER (popover->widget))
gtk_popover_update_position (GTK_POPOVER (popover->widget));
popover_get_rect (popover, window, &rect);
- gtk_widget_size_allocate (widget, &rect);
+ gtk_widget_size_allocate (widget, &rect, -1, &clip);
}
/* _gtk_window_set_allocation:
!priv->fullscreen)
{
GtkAllocation title_allocation;
+ GtkAllocation title_clip;
title_allocation.x = window_border.left;
title_allocation.y = window_border.top;
title_allocation.height = priv->title_height;
- gtk_widget_size_allocate (priv->title_box, &title_allocation);
+ gtk_widget_size_allocate (priv->title_box, &title_allocation, -1, &title_clip);
}
if (priv->decorated &&
}
static void
-gtk_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_window_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (window));
if (child && gtk_widget_get_visible (child))
- gtk_widget_size_allocate (child, &child_allocation);
-
- gtk_widget_set_clip (widget, allocation);
+ gtk_widget_size_allocate (child, &child_allocation, -1, out_clip);
}
static gint
if (priv->configure_notify_received)
{
GtkAllocation allocation;
+ GtkAllocation clip;
int min;
/* If we have received a configure event since
allocation.x = 0;
allocation.y = 0;
- /*allocation.width = current_width;*/
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, -1,
&min, NULL, NULL, NULL);
&min, NULL, NULL, NULL);
allocation.height = MAX (min, current_height);
- gtk_widget_size_allocate (widget, &allocation);
+ gtk_widget_size_allocate (widget, &allocation, -1, &clip);
/* If the configure request changed, it means that
* we either:
if (priv->type == GTK_WINDOW_POPUP)
{
- GtkAllocation allocation;
+ GtkAllocation allocation;
+ GtkAllocation clip;
/* Directly size allocate for override redirect (popup) windows. */
allocation.x = 0;
allocation.width = new_request.width;
allocation.height = new_request.height;
- gtk_widget_size_allocate (widget, &allocation);
+ gtk_widget_size_allocate (widget, &allocation, -1, &clip);
}
else
{
}
else
{
- GtkAllocation allocation;
+ GtkAllocation allocation, clip;
/* Handle any position changes.
*/
allocation.width = current_width;
allocation.height = current_height;
- gtk_widget_size_allocate (widget, &allocation);
+ gtk_widget_size_allocate (widget, &allocation, -1, &clip);
}
/* We have now processed a move/resize since the last position
}
static void
-gtk_stack_combo_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+gtk_stack_combo_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkStackCombo *self = GTK_STACK_COMBO (widget);
- GtkAllocation clip = *allocation;
-
- gtk_widget_size_allocate (GTK_WIDGET (self->combo), allocation);
- gtk_widget_get_clip (GTK_WIDGET (self->combo), &clip);
-
- gtk_widget_set_clip (widget, &clip);
+ gtk_widget_size_allocate (GTK_WIDGET (self->combo), allocation, baseline, out_clip);
}
static void
}
static void
-allocation_changed (GtkWidget *w, GdkRectangle *allocation, GtkInspectorMiscInfo *sl)
+allocation_changed (GtkWidget *w,
+ GdkRectangle *allocation,
+ int baseline,
+ GdkRectangle *out_clip,
+ GtkInspectorMiscInfo *sl)
{
GtkAllocation alloc;
GtkAllocation clip;
state_flags_changed (GTK_WIDGET (sl->priv->object), 0, sl);
g_signal_connect_object (object, "size-allocate", G_CALLBACK (allocation_changed), sl, 0);
- allocation_changed (GTK_WIDGET (sl->priv->object), NULL, sl);
+ allocation_changed (GTK_WIDGET (sl->priv->object), NULL, -1, NULL, sl);
}
else
{
G_DEFINE_TYPE(GtkFocusWidget, gtk_focus_widget, GTK_TYPE_WIDGET)
static void
-gtk_focus_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
+gtk_focus_widget_size_allocate (GtkWidget *widget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip)
{
GtkFocusWidget *self = GTK_FOCUS_WIDGET (widget);
int child_width = (allocation->width) / 2;
child_alloc.width = child_width;
child_alloc.height = child_height;
- gtk_widget_size_allocate (self->child1, &child_alloc);
+ gtk_widget_size_allocate (self->child1, &child_alloc, -1, out_clip);
child_alloc.x += child_width;
- gtk_widget_size_allocate (self->child2, &child_alloc);
+ gtk_widget_size_allocate (self->child2, &child_alloc, -1, out_clip);
child_alloc.y += child_height;
- gtk_widget_size_allocate (self->child4, &child_alloc);
+ gtk_widget_size_allocate (self->child4, &child_alloc, -1, out_clip);
child_alloc.x -= child_width;
- gtk_widget_size_allocate (self->child3, &child_alloc);
+ gtk_widget_size_allocate (self->child3, &child_alloc, -1, out_clip);
}
static void